{extend name="common:frm_base" /}
{block name="content"}
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-header">{if $act eq 'add'}添加{else}编辑{/if}合作商</div>
        <div class="layui-card-body" style="padding: 15px;">
            <form class="layui-form" action="{:url('Fleet/handle')}" lay-filter="component-form-group">
                <div class="layui-form-item">
                    <label class="layui-form-label">账户</label>
                    <div class="layui-input-inline">
                        <input type="text" value="{$info['name']|default=''}" name="name" lay-verify="required" placeholder="请输入"  autocomplete="new-password" class="layui-input">
                    </div>
                    <div class="layui-form-mid layui-word-aux">用于后台登录</div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">合作商名称</label>
                    <div class="layui-input-inline">
                        <input type="text" value="{$info['nick_name']|default=''}" name="nick_name" lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">联系方式</label>
                    <div class="layui-input-inline">
                        <input type="text" value="{$info['mobile']|default=''}" name="mobile" lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">合作商LOGO</label>
                    <div class="layui-input-block" style="display:flex;">
                        <div style="width:100px;height:100px;border:1px solid #e0e0e0;">
                            <img id="bus_img_btn" style="width:100px;height:100px;" src="{if $info['logo']}{$info['logo']}{else /}/add.jpg{/if}">
                        </div>
                        <input type="hidden" value="{$info['logo']|default=''}" id="logo" name="logo">
                    </div>
                </div>
                <input type="hidden" name="role_id" value="2">
                <div class="layui-form-item">
                    <label class="layui-form-label">管理员密码</label>
                    <div class="layui-input-inline">
                        <input type="password" value="" name="password" placeholder="请输入" autocomplete="off" class="layui-input">
                    </div>
                    <div class="layui-form-mid layui-word-aux">密码为空即表示不修改密码</div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">确认密码</label>
                    <div class="layui-input-inline">
                        <input type="password" value="" name="r_password" placeholder="请输入" autocomplete="off" class="layui-input">
                    </div>
                    <div class="layui-form-mid layui-word-aux"></div>
                </div>
                <!--<div class="layui-form-item">-->
                <!--<label class="layui-form-label">管理员</label>-->
                <!--<div class="layui-input-block">-->
                <!--<input type="checkbox" name="is_admin" {if $info.is_admin==1 }checked{/if} lay-skin="switch" value="1" lay-text="ON|OFF">-->
                <!--</div>-->
                <!--</div>-->
                {if $role['role_id']!=3}
                <div class="layui-inline">
                    <label class="layui-form-label">状态</label>
                    <div class="layui-input-block">
                        <input type="radio" name="status" value="0" title="审核中" {if $info.status==0 }checked{/if}>
                        <input type="radio" name="status" value="1" title="审核通过" {if $info.status==1 }checked{/if}>
                        <input type="radio" name="status" value="2" title="审核不通过" {if $info.status==2 }checked{/if}>
                    </div>
                </div>
                {else /}
                <input type="hidden" name="status" value="{$info['status']}">
                {/if}
                <input type="hidden" value="{$act}" name="act" />
                <input type="hidden" value="{$info['id']|default=''}" name="id" />
                <div class="layui-form-item layui-hide">
                    <input type="button" lay-submit lay-filter="LAY-user-front-submit" id="LAY-user-front-submit" value="确认">
                </div>
                <!--<div class="layui-form-item layui-layout-admin">-->
                <!--<div class="layui-input-block">-->
                <!--<div class="layui-footer" style="left: 0;">-->
                <!--<button class="layui-btn" lay-submit="" lay-filter="component-form-demo1">立即提交</button>-->
                <!--<button type="reset" class="layui-btn layui-btn-primary">重置</button>-->
                <!--</div>-->
                <!--</div>-->
                <!--</div>-->
            </form>
        </div>
    </div>
</div>


<script>
    layui.config({
        base: '__LAYUIADMIN__/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'form', 'laydate', 'upload'], function () {
        var $ = layui.$
            , form = layui.form
            ,upload = layui.upload
            , table = layui.table;

        form.render(null, 'component-form-group');

        var uploadInst = upload.render({
            elem: '#bus_img_btn'
            , url: "{:url('common/upload_img')}"
            , data: {name:'ad'}
            , accept: 'images'
            , acceptMime: 'image/*,image/gif'
            , done: function (res) {
                $('#bus_img_btn').attr('src',res.data.img);
                $('#logo').val(res.data.img);
            }
            , error: function () {
            }
        });

    });
</script>
</body>
</html>
{/block}